home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / AECUR100.ARJ / WCENTSTR.C < prev    next >
C/C++ Source or Header  |  1990-03-08  |  587b  |  30 lines

  1. /*----------------------------------------------------------------------
  2.  *
  3.  *  wcentstr.c
  4.  *
  5.  *  copyright (c) 1987,88,89,90 J. Alan Eldridge
  6.  *
  7.  *  center a string on given row of a Curses window
  8.  *
  9.  *----------------------------------------------------------------------
  10.  */
  11.  
  12. #include "curses.h"
  13.  
  14. int
  15. wcentstr(win, row, str)
  16. WINDOW  *win;
  17. int     row;
  18. char    *str;
  19. {
  20.     int skip;
  21.  
  22.     skip = (win->maxx + 1 - strlen(str)) / 2;
  23.     wmove(win, row, 0);
  24.     wclrtoeol(win);
  25.     if (skip > 0)
  26.         wmove(win, row, skip);
  27.  
  28.     return waddstr(win, str);
  29. }
  30.